﻿<%@ Page Language="C#" AutoEventWireup="true" %>
<script runat="server">
    
    string redirectParam = string.Empty;
    
    protected void Page_Load(object sender, EventArgs e)
    {
        
        // if the error came from a control, we can't redirect to it. we'll need to redirect back to the 
        // originating URL instead
        var hostingUrl = Request.QueryString["HostingUrl"];
        if (hostingUrl != null)
        {
            this.redirectParam = String.Format(", expiryUrl: '{0}'", hostingUrl);
        }
        else
        {
            this.redirectParam = String.Format(", expiryUrl: '{0}'", Request.RawUrl);
        }
        //Response.End();
    }

</script>
<asp:Content runat="server" ID="Head" ContentPlaceHolderID="HeadContentPlaceHolder">
    <script type="text/javascript" src="/Scripts/plugins/jquery.countdown/jquery.countdown.js"></script> 
    <script type="text/javascript">
    <!--
        $(function() {
            var refreshTime = new Date();
            refreshTime.setSeconds(refreshTime.getSeconds() + 60);
            $('#defaultCountdown').countdown({ until: refreshTime, compact: true, format: 'S' <%=this.redirectParam%> });
        });
    //-->
    </script>
</asp:Content>
<asp:Content runat="server" ID="Body" ContentPlaceHolderID="BodyContentPlaceHolder">
    <div class="extremelyLargeTitle">
    OUCH.
    <p style="font-size: 20pt;">An Error has occurred. Sorry about this.</p>
    <% if (this.redirectParam != String.Empty) { %><p style="font-size: 16pt;">Retrying in <span id="defaultCountdown"></span> seconds.</p><% } %>
    </div>
</asp:Content>